#include "cobra11syndicate.hlsli"
#include "standard.hlsli"

struct VS_Input_C11Auto 
{
float4 position : Position /* dcl_position v0 */ ;
float4 normal : normal /* dcl_normal v1 */ ;
float4 texcoord1 : texcoord1 /* dcl_texcoord v2 */ ;
float4 texcoord2 : texcoord2 /* dcl_texcoord1 v3 */ ;
float4 vertexColor : color1 /* dcl_color v4 */ ;
float4 DiffuseColor : color0 /* dcl_color1 v5 */ ;
};




struct PS_Input_C11Auto
{
float4 position : SV_Position /* dcl_position o0 */ ;
float3 normal : texcoord /* dcl_texcoord o3.xyz */ ;
float3 distanceToCamera : texcoord1 /* dcl_texcoord1 o4.xyz */ ;
float4 texCoord5 : texcoord2 /* dcl_texcoord2 o5 */ ;
float4 texCoord6 : texcoord4 /* dcl_texcoord4 o6 */ ;
float4 texCoord7 : texcoord6 /* dcl_texcoord6 o7 */ ;
float4 texCoord8 : texcoord7 /* dcl_texcoord7 o8 */ ;
float4 VertexColor : color /* dcl_color o1 */ ;
float4 diffuseColor : color1 /* dcl_color1 o2 */ ;
float fog : FOG /* dcl_fog o9.x */ ;
};


PS_Input_C11Auto vs_main(VS_Input_C11Auto vsInAuto) 
{

float4 c0 = float4(2, -1, -1.44269502, 0.000250000012); // def c0, 2, -1, -1.44269502, 0.000250000012
float4 c1 = float4(1, 0, 0, 0); // def c1, 1, 0, 0, 0


PS_Input_C11Auto psInAuto = (PS_Input_C11Auto)0;
float4 r0 = (float4)0;
float4 r1 = (float4)0;
float4 r2 = (float4)0;



r0.xyz = vsInAuto.normal.xyz * c0.x +  c0.y;//mad r0.xyz, v1, c0.x, c0.y
r0.w = dot(r0.xyz, r0.xyz);//dp3 r0.w, r0, r0
r0.w = rsqrt(r0.w);//rsq r0.w, r0.w
psInAuto.normal.xyz = r0.w * r0.xyz;//mul o3.xyz, r0.w, r0
r0.xyzw = WorldOffset.xyzw + vsInAuto.position.xyzw;//add r0, c33, v0
r1.xyz = r0.xyz + -g_CameraPosition.xyz;//add r1.xyz, r0, -c32
r1.xyz = r1.xyz * RangeFog.w;//mul r1.xyz, r1, c31.w
r1.x = dot(r1.xyz, r1.xyz);//dp3 r1.x, r1, r1
r1.x = r1.x * c0.z;//mul r1.x, r1.x, c0.z
psInAuto.fog.x = exp(r1.x);//exp o9.x, r1.x
r1.xyz = vsInAuto.DiffuseColor.xyz * vsInAuto.DiffuseColor.xyz;//mul r1.xyz, v5, v5
r1.xyz = r1.xyz * AmbLevel.xyz;//mul r1.xyz, r1, c30
r1.w = vsInAuto.DiffuseColor.w;//mov r1.w, v5.w
psInAuto.diffuseColor.xyzw = r1.xyzw + TerrainAmbient.xyzw;//add o2, r1, c48
psInAuto.distanceToCamera.xyz = -r0.xyz + g_CameraPosition.xyz;//add o4.xyz, -r0, c32
r1.x = dot(r0.xyzw, worldViewProj._m00_m10_m20_m30);// dp4 r1.x, r0, c20
r1.y = dot(r0.xyzw, worldViewProj._m01_m11_m21_m31);// dp4 r1.y, r0, c21
r1.z = dot(r0.xyzw, worldViewProj._m02_m12_m22_m32);// dp4 r1.z, r0, c22
r2.x = dot(r1.xyz, r1.xyz);//dp3 r2.x, r1, r1
r2.x = rsqrt(r2.x);//rsq r2.x, r2.x
r2.x = 1.0f / r2.x;//rcp r2.x, r2.x
psInAuto.texCoord7.w = r2.x * c0.w;//mul o7.w, r2.x, c0.w
r2.xyzw = r0.xyzx * c1.xxxy +  c1.yyyx;//mad r2, r0.xyzx, c1.xxxy, c1.yyyx
r1.w = dot(r0.xyzw, worldViewProj._m03_m13_m23_m33);// dp4 r1.w, r0, c23
psInAuto.texCoord8.x = dot(r2.xyzw, ShadowMtx._m00_m10_m20_m30);// dp4 o8.x, r2, c24
psInAuto.texCoord8.y = dot(r2.xyzw, ShadowMtx._m01_m11_m21_m31);// dp4 o8.y, r2, c25
psInAuto.texCoord8.z = dot(r2.xyzw, ShadowMtx._m02_m12_m22_m32);// dp4 o8.z, r2, c26
psInAuto.texCoord8.w = dot(r2.xyzw, view._m02_m12_m22_m32);// dp4 o8.w, r2, c11
psInAuto.position.xyzw = r1.xyzw;//mov o0, r1
psInAuto.texCoord7.xyz = r1.w;//mov o7.xyz, r1.w
psInAuto.VertexColor.xyzw = vsInAuto.vertexColor.xyzw;//mov o1, v4
psInAuto.texCoord5.xyzw = vsInAuto.texcoord1.xyxy;//mov o5, v2.xyxy
psInAuto.texCoord6.xyzw = vsInAuto.texcoord2.xyxy;//mov o6, v3.xyxy
return psInAuto;
}


